package com.dzh.test;

import java.util.Scanner;

/**
 * @Author 戴志豪
 * @date 2022/10/10 10:39
 */
public class DescSorted {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("输入数字：");
        int a = scanner.nextInt();
        int count=0;

        System.out.println(descNum(a));

        while (a!=0){
            System.out.println(a%10);
            a/=10;
            count++;
        }

        System.out.println(count);

    }



    /**
     * 倒序数字
     * @param num   入参数字
     * @return      倒序后的数字
     */
    public static int descNum(int num){
        StringBuilder stringBuilder = new StringBuilder();

        while (num!=0){
            stringBuilder.append(num%10);
            num/=10;
        }

        return Integer.parseInt(String.valueOf(stringBuilder));
    }
}
